

/*---------------------------------------------------------
   Initializes the effect. The data is a table of data 
   which was passed from the server.
---------------------------------------------------------*/
function EFFECT:Init( data )
	
	self.SprayTime = CurTime() + 3.5
	self.Ent = data:GetEntity()
	if self.Ent == nil or self.Ent == NULL then return end

	self.Emitter = ParticleEmitter( self.Ent:GetPos() )
		
end


/*---------------------------------------------------------
   THINK
   Returning false makes the entity die
---------------------------------------------------------*/
function EFFECT:Think( )
	if (self.Ent == nil or self.Ent == NULL) or self.SprayTime < CurTime() then 
		if self.Emitter then
			self.Emitter:Finish()
		end
	return false end
	
	if not self.Ent:Alive() then
		self.Emitter:Finish()
	end

	self.Pos = self.Ent:GetShootPos() + self.Ent:GetUp() * -20
	self.Ang = self.Ent:GetAimVector()
			
	if math.random(1,4) != 4 then
		local particle = self.Emitter:Add( ChooseRandom({"particle/particle_smokegrenade","particles/smokey","effects/blood_core","effects/blood"}), self.Pos )
		particle:SetVelocity( self.Ang * math.random(550,600) + Vector(0,0,100) )
		particle:SetDieTime( math.Rand( 1, 2 ) )
		particle:SetStartAlpha( math.Rand( 100, 180 ) )
		particle:SetEndAlpha( 1 )
		particle:SetStartSize( math.Rand( 2, 4 ) )
		particle:SetEndSize( math.Rand( 30, 60 ) )
		particle:SetRoll( math.Rand( 0, 360 ) )
		particle:SetRollDelta( math.Rand( -0.1, 0.1 ) )
		particle:SetColor( math.Rand( 100, 170 ), math.Rand( 100, 150 ), 50 )
		particle:VelocityDecay( false )
		
		particle:SetAirResistance( 100 )
		particle:SetGravity( Vector( 0, 0, -500 ) )
		particle:SetCollide( true )
		particle:SetBounce( .65 )
	end	

	return true
end


/*---------------------------------------------------------
   Draw the effect
---------------------------------------------------------*/
function EFFECT:Render()

	
end



